
/*
 * @Script: t7.c
 * @Author: ystlong
 * @Email: ystlong@163.com
 * @Create At: yyyy-03-dd 22:46:23
 * @Last Modified By: ystlong
 * @Last Modified At: yyyy-03-dd 22:46:23
 * @Description: This is description.
 */

#include <stdio.h>

long lastn(long n)
{
    if (n == 1)
        return n;
    long k = n * lastn(n - 1);
    while (k % 10 == 0) {
        k /= 10;
    }
    return k % 10000;
}

long nn(long n)
{
    if (n == 1)
        return n;
    return nn(n - 1) * n;
}

int main()
{
    for (long i = 1; i < 25; i++) {
        printf("nn %16ld %16lu %16ld\n", i, nn(i), lastn(i)%10);
    }
    return 0;
}